{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li class="active"><a href="#">代理申请列表</a></li>
</ul>
<div class="app-content">
	<div class="app-table-list">
		<div class="table-responsive">
			<table class="table table-hover table-bordered">
				<thead>
				<tr>
					<th class="text-center" style="width:120px;">vip类型</th>
					<th class="text-center" style="width:60px;">时长</th>
					<th class="text-center" style="width:60px;">申请数量</th>
					<th class="text-center" style="width:60px;">申请状态</th>
					<th class="text-center" style="width:120px;">申请时间</th>
					<th class="text-center" style="width:120px;">操作</th>
				</tr>
				</thead>
				<tbody>
				{loop $applys $item}
				<tr class="text-center" >
					<td>
					<span class="label label-info">
					{$item['token']['name']}
					</span>
						{if !empty($item['aid'])}
						&nbsp;
						<span class="label label-primary">
					 {$item['aName']}
					</span>
						{else}
						<span class="label label-danger">
					系统
					</span>
						{/if}
					</td>
					<td>
						{$item['token']['days']}天
					</td>
					<td>{$item['num']}</td>
					<td>
						{if $item['status']==1}
						<span id="" class="label label-danger">
					申请中
					</span>
						{else}
						<span id="" class="label label-primary">
					已生成
					</span>
						{/if}
					</td>
					<td>{php echo date('Y-m-d H:i:s',$item['createtime'])}</td>
					<td>
						{if $item['status']==1}
						<a href="{php echo web_url('halfcard/halfcode/add',array('applyid'=>$item['id']))}" title="生成"  class="btn btn-danger btn-sm">生成</a>
						{else}
						<a href="#" title="已生成"  class="btn btn-primary btn-sm">已完成</a>
						{/if}
						- <a href="javascript:;" title="删除" id="{$item['id']}" class="btn btn-danger remove">删除</a>
					</td>
				</tr>
				{/loop}
				</tbody>
			</table>
		</div>
		<div class="app-table-foot clearfix">
			<div class="pull-left">
				
			</div>
			<div class="pull-right">
				{$pager}
			</div>
		</div>
	</div>
</div>
<script>
	$('.remove').click(function(e){
			e.stopPropagation();
			var $this = $(this);
			var id = $this.attr('id');
			util.nailConfirm(this, function(state) {
				if(!state) return;
				$.post("{php echo web_url('halfcard/halfcode/deapply')}", { id : id }, function(data){
					if(!data.errno){
						$this.parent().parent().remove();
						util.tips("删除成功！");
					};
				}, 'json');
			}, {html: '确认删除?'});
		});
</script>
{php include wl_template('common/footer');}